home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 June: Reference Library / Dev.CD Jun 94.toast / Periodicals / develop / develop Issue 11 / develop 11 code / Async Sound Helper / SoundHelper / SHPrivate.h next >
Encoding:
Text File  |  1992-07-15  |  3.7 KB  |  74 lines  |  [TEXT/MPS ]

  1. //=======================================================================================
  2. //
  3. // SHPrivate.h - private header for the Asynchronous Sound Helper
  4. //
  5. // Written by Bryan K. Ressler (Beaker), 2/4/92
  6. //
  7. // Version 1.00, 2/4/92        Original version
  8. //         1.01, 2/20/92    Added SHGetState to fix handle semaphore problem
  9. //         1.02, 3/21/92    Make handle/error checks more explicit, modify
  10. //                             SHPlayStopByRec (to handle channels with no synthesizer)
  11. //         1.03, 4/4/92        Modifications per KO, RC, JR.  Public routines now pascal.
  12. //         1.04, 4/20/92    Reverted to SHPlayPause/SHPlayContinue structure.
  13. //
  14. //=======================================================================================
  15.  
  16. //=======================================================================================
  17. // Includes
  18. //=======================================================================================
  19. #include "Std.h"
  20.  
  21. //=======================================================================================
  22. // Contants used by the Asynchronous Sound Helper
  23. //=======================================================================================
  24. #define kSHDefChannels        4        // Default number of channels to preallocate
  25. #define kSHCompleteSig        'SH'    // Flag we use to know a "true" completion callback
  26. #define kSHComplete            'SHcp'    // Flag that a given channel has completed playback
  27. #define kSHHeaderSlop        100        // Extra bytes for the sound header when recording
  28. #define kSHBaseNote            60        // Middle C base note for new recordings
  29. #define kSHSyncWaitTimeout    60        // Ticks to sync-wait when killing the Helper
  30.  
  31. //=======================================================================================
  32. // Constants that should be in Sound.h but aren't
  33. //=======================================================================================
  34. #define kSHNoSynth            0        // Don't associate any synth to this channel
  35. #define kSHNoInit            0        // No specific initialization
  36. #define kSHQuietNow            true    // Stop playing this sound immediately
  37. #define kSHAsync            true    // Play asynchronously
  38. #define kSHWait                false    // Wait for there to be enough room in the queue
  39.  
  40. //=======================================================================================
  41. // Structures
  42. //=======================================================================================
  43. typedef struct {
  44.     SndChannel    channel;            // Our sound channel
  45.     long        refNum;                // Our Helper ref num
  46.     Handle        sound;                // The sound we're playing
  47.     Fixed        rate;                // The rate at which a sampled sound is playing
  48.     char        handleState;        // The handle state to restore this handle to
  49.     Boolean        inUse;                // Tells whether this SHOutRec is in use
  50.     Boolean        paused;                // Tells whether this sound is currently paused
  51. } SHOutRec, *SHOutPtr;
  52.  
  53. typedef struct {
  54.     short        numOutRecs;            // The number of output records in outArray
  55.     SHOutRec    *outArray;            // Our pre-allocated output records
  56.     long        nextRef;            // The next available output reference number
  57. } SHOutputVars;
  58.  
  59. typedef struct {
  60.     long        inRefNum;            // Sound Input Manager's device refNum
  61.     SPB            inPB;                // The input parameter block
  62.     Handle        inHandle;            // The handle we're recording into
  63.     short        headerLength;        // The length of the sound's header
  64.     Boolean        recording;            // Tells whether we're actually recording
  65.     Boolean        recordComplete;        // Tells whether recording is complete
  66.     OSErr        recordErr;            // Error, if error terminated recording
  67.     short        numChannels;        // Number of channels for recording
  68.     short        sampleSize;            // Sample size for recording
  69.     Fixed        sampleRate;            // Sample rate for recording
  70.     OSType        compType;            // Compression type for recording
  71.     Boolean        *appComplete;        // Flag to caller that recording is done
  72.     Boolean        paused;                // Tells whether recording has been paused
  73. } SHInputVars;
  74.